package com.toket.android.pushme.gcm;

import android.content.Context;
import android.util.Log;

import com.google.android.gcm.GCMRegistrar;
import com.toket.android.pushme.R;

public class ServerUtilities extends CommonUtilities{

	/**
	 * Register this account/device pair within the server.
	 * 
	 */
	static void register(final Context context, String name, String email,
			final String regId) {
		Log.i(TAG, "registering device (regId = " + regId + ")");
		GCMRegistrar.setRegisteredOnServer(context, true);
		String message = context.getString(R.string.server_registered);
		CommonUtilities.displayMessage(context, message);
	}

	/**
	 * Unregister this account/device pair within the server.
	 */
	static void unregister(final Context context, final String regId) {
		Log.i(TAG, "unregistering device (regId = " + regId + ")");
		
		GCMRegistrar.setRegisteredOnServer(context, false);
		String message = context.getString(R.string.server_unregistered);
		CommonUtilities.displayMessage(context, message);
	}
	
}
